/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modele;

import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;


/**
 *
 * @author plasalmonie
 */
public class Connect {
    
    private static Connection con = null;
    private static Connection open(){
       try {
            Class.forName("org.postgresql.Driver");
        } catch (ClassNotFoundException ex) {
            System.out.println("Pilote mal Installé ...");
        }
        try {
            con = DriverManager.getConnection("jdbc:postgresql://lucie/medecin", "plasalmonie", "xxx");
        } catch (SQLException e) {
        System.out.println("Erreur SQL ..." + e);
         }
       return con;        
}

    public static Connection get(){
        if (con == null){
            con = Connect.open();
        }
        return con;
    }
    public static void close(){
        try{
            con.close();
        } catch(SQLException e) {
            System.out.println("Erreur SQL :" + e );
        }
    }
}
    
    

